package 初级算法8月开始.数组;
// https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/
public class 删除有序数组中的重复项26之0815 {
    class Solution {
        public int removeDuplicates(int[] nums) {
            int n = nums.length;
            if (n == 0) {//
                return 0;
            }
            int fast = 1, slow = 1;
            while (fast < n) {
                if (nums[fast] != nums[fast - 1]) {
                    nums[slow] = nums[fast];
                    ++slow;
                }
                ++fast;
            }
            return slow;
        }
    }
}
